<?php
/**
 * auth_info表model
 * 
 * @author sz 2016-9-14 11:32:53
 * @version 1.0
 */
namespace Home\Model;
use Think\Model;

class AuthInfoModel extends Model
{

    /**
     * model对应表和数据库信息
     *
     * @author sz 2016-9-14 11:33:02
     * @version 1.0
     */
    function __construct ()
    {
        parent::__construct('auth_info', null, 'HAICHUANG');
    }

    /**
     * getGroupInfo
     *
     * @param            
     *
     * @return 获取商铺信息
     * @author sz 2016-9-14 11:33:06
     * @version 1.0
     */
    public function getGroupInfo ()
    {
        $sql = "SELECT * FROM auth_info ORDER BY parent_id ASC";
        return $this->query($sql);
    } 

    /**
     * getAuthByName
     *
     * @param
     *
     * @return 获取信息
     * @author sz 2016-9-14 11:33:06
     * @version 1.0
     */
    public function getAuthByName ($name)
    {
        $sql = "SELECT * FROM auth_info WHERE controller_name='$name'";
        return $this->query($sql);
    }
    
    /**
     * getAuthByGroupId
     *
     * @param
     *
     * @return 获取信息
     * @author sz 2016-9-14 11:33:06
     * @version 1.0
     */
    public function getAuthByGroupId ($group_ids)
    {
        $sql = "SELECT * FROM auth_info WHERE id IN ($group_ids)";
        return $this->query($sql);
    }
    
    /**
     * getAuthById
     *
     * @param
     *
     * @return 获取信息
     * @author sz 2016-9-14 11:33:06
     * @version 1.0
     */
    public function getAuthById($auth_parent_id)
    {
        $sql = "SELECT * FROM auth_info WHERE parent_id=$auth_parent_id";
        return $this->query($sql);
    }
}
?>